package com.yn.xr.middleware.user.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.Transactional;

import com.yn.core.service.impl.BaseServiceImpl;
import com.yn.xr.common.constants.UserConstants;
import com.yn.xr.common.exception.base.BaseException;
import com.yn.xr.middleware.user.service.UserRegisterService;
import com.yn.xr.user.mode.UserRegister;

/**
 * @description: 用户模块接口实现
 * @fileName:UserRegisterServiceImpl.java
 * @createTime:2015年1月24日 下午18:12:10
 * @author:陈权福
 * @version 1.0.0
 * 
 */
@Transactional
public class UserRegisterServiceImpl extends BaseServiceImpl<UserRegister, Long> implements UserRegisterService {
	private static final long serialVersionUID = -1059889733382990539L;

	private static final Logger logger = LoggerFactory.getLogger(UserRegisterServiceImpl.class);
	
	/**
     * 根据用户名密码查询有效用户
     * @param accName
     * @param passWord
     * @return
     * @throws Exception
     */
	public UserRegister queryUserRegisterByAccNameAndPass( String accName , String passWord ) throws Exception {
		String hql = " from UserRegister where accName = ? and pwd = ? and  status = ? ";
		List<UserRegister> userRegisterList = this.findForHqlPre(hql, accName,passWord,UserConstants.USER_ACTIVED_STATUS);
		if(  userRegisterList != null && userRegisterList.size() > 0 ){
			return userRegisterList.get(0);
		}else{
			return null;
		}
	}
	

}
